/**   
 * @Title: ROJsonResult.java 
 * @Package com.redone.bureau.util 
 * @Description: TODO 
 * @author PC   
 */

package com.amani.util;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.json.JSONResult;
import org.apache.struts2.json.SerializationParams;

/**
 * @ClassName: ROJsonResult
 * @Description: TODO 
 * @author PC
 */

public class ROJSONResult extends JSONResult {

	private static final long serialVersionUID = -997525907667125535L;
	private int statusCode;
	private int errorCode;
	private boolean prefix;
	private String contentType;

	@Override
	protected void writeToResponse(HttpServletResponse response, String json,
			boolean gzip) throws IOException {
		ROJSONUtil.writeJSONToResponse(new SerializationParams(response,
				getEncoding(), isWrapWithComments(), json, false, gzip,
				isNoCache(), statusCode, errorCode, prefix, contentType,
				getWrapPrefix(), getWrapSuffix()));
	}

	public void setStatusCode(int statusCode) {
		this.statusCode = statusCode;
	}

	public void setErrorCode(int errorCode) {
		this.errorCode = errorCode;
	}

	public void setPrefix(boolean prefix) {
		this.prefix = prefix;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}
}
